package com.ledim.utils;

import java.util.regex.Pattern;

public class EmotionHelper {

    private static Pattern pattern = Pattern.compile("o(≧口≦)o");
    private static String[] emojiCodes = new String[] {
            "o(≧口≦)o",

            "(￣y▽,￣)╭",

            "o(*≧▽≦)ツ",

            "<(￣3￣)>",

            "╭∩╮(︶︿︶）╭∩╮",

            "(＠_＠;)?",

            "(。>︿<)_θ",

            "<(＿　＿)>",

            "o(￣ε￣*)",

            "(╯‵□′)╯︵┻━┻",

            "╮(╯-╰)╭",

            "||o(*°▽°*)o|Ю",

            "<( ‵□′)───C＜─___-)||",

            "o(*≧▽≦)ツ┏━┓",

            "(☆▽☆)",

            "o(≧∩≦)o",

            "o((>ω< ))o",

            "╰（‵□′）╯",

            "^(*￣(oo)￣)^",

            "Σ( ° △ °|||)︴",

            "(*￣︿￣)"

    };

    public static int replaceDel(String str, int index) {
        for (String s : emojiCodes) {
            String sub = str.substring(0, index);
            if (sub.length() >= s.length()) {
                String ss = sub.substring(sub.length() - s.length(), sub.length());
                if (ss.equals(s)) {
                    return index - s.length();
                }
            }
        }
        return index - 1;
    }

}

